package cn.daniellee.plugin.wc.runnable;

import cn.daniellee.plugin.wc.Welcome;
import cn.daniellee.plugin.wc.core.WelcomeCore;
import org.bukkit.scheduler.BukkitRunnable;

public class WelcomeRunnable extends BukkitRunnable {

    @Override
    public void run() {
        // 清除已过欢迎时效的缓存
        WelcomeCore.newPlayerCache.forEach((key, value) -> {
            if (System.currentTimeMillis() - value.getJoinDate() > Welcome.getInstance().getPeriod()) {
                WelcomeCore.newPlayerCache.remove(key);
            }
        });
    }

}
